package com.hongsen.cn.presenter;

import com.hongsen.cn.Utils.GsonUtils;
import com.hongsen.cn.application.DayAndMonthApplication;
import com.hongsen.cn.base.BaseModel;
import com.hongsen.cn.base.BaseObserver;
import com.hongsen.cn.base.BasePresenter;
import com.hongsen.cn.bean.BaseTitleBean;
import com.hongsen.cn.bean.PoliceListBean;
import com.hongsen.cn.contract.SearchPersonView;

import java.util.List;

public class SearchPersonPresenter extends BasePresenter<SearchPersonView> {

    public SearchPersonPresenter(SearchPersonView baseView) {
        super(baseView);
    }


    /**
     * 获取警员列表
     */
    public void getList() {
        addDisposable(restApi.getList(), new BaseObserver(baseView) {
            @Override
            public void onSuccess(Object o) {
                BaseModel<List<PoliceListBean>> model = (BaseModel<List<PoliceListBean>>) o;
                baseView.getPolices(model.getData());
                DayAndMonthApplication.getInstance().logger.debug(">>>mjMjxxb/getList民警:" + GsonUtils.getInstance().toJson(model));
            }

            @Override
            public void onError(String msg) {
                DayAndMonthApplication.getInstance().logger.debug(">>>mjMjxxb/getList民警列表:" + msg);
            }
        });
    }

}
